<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>
  File: README
  
    &mdash; Documentation by YARD 0.8.2.1
  
</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '';
  framesUrl = "frames.html#!" + escape(window.location.href);
</script>


  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="_index.html">Index</a> &raquo; 
    <span class="title">File: README</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><div id='filecontents'><p>ActiveFedora::RelsInt</p>
<p>A mixin for ActiveFedora to allow use and updating of the <span class="caps">RELS</span>-<span class="caps">INT</span> datastream.</p>
<p><span class="caps">RELS</span>-<span class="caps">INT</span> is similar to <span class="caps">RELS</span>-<span class="caps">EXT</span>: A shallow (depth = 1) <span class="caps">XML</span> serialization of a <span class="caps">RDF</span> graph.
However, the subjects of triples in the <span class="caps">RELS</span>-<span class="caps">INT</span> graph are an object&#8217;s datastreams.</p>
<p>For example, consider a Fedora object with a <span class="caps">PID</span> of &#8216;test:1&#8217; that hold a <span class="caps">TIFF</span> image in a datastream called &#8216;content&#8217;.
You may add various derivative images in additional datastreams, but feel that relying on encoded
 datastream IDs is too fragile an approach to indicating their relationship to &#8216;content&#8217;.  You may
 indicate these relationships in a <span class="caps">RELS</span>-<span class="caps">INT</span> like the below:</p>
<pre class="code ruby"><code>&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;&gt;
  &lt;rdf:Description rdf:about=&quot;info:fedora/test:1/content&quot;&gt;
    &lt;pixelXDimension xmlns=&quot;http://www.kanzaki.com/ns/exif#&quot;&gt;2400&lt;/pixelXDimension&gt;
    &lt;pixelYDimension xmlns=&quot;http://www.kanzaki.com/ns/exif#&quot;&gt;1600&lt;/pixelYDimension&gt;
    &lt;thumbnail xmlns=&quot;http://xmlns.com/foaf/0.1/&quot; rdf:resource=&quot;info:fedora/test:1/ds1&quot; /&gt;
  &lt;/rdf:Description&gt;
  &lt;rdf:Description rdf:about=&quot;info:fedora/test:1/ds1&quot;&gt;
  &lt;pixelXDimension xmlns=&quot;http://www.kanzaki.com/ns/exif#&quot;&gt;150&lt;/pixelXDimension&gt;
  &lt;pixelYDimension xmlns=&quot;http://www.kanzaki.com/ns/exif#&quot;&gt;100&lt;/pixelYDimension&gt;
  &lt;/rdf:Description&gt;
  &lt;rdf:Description rdf:about=&quot;info:fedora/test:1/ds2&quot;&gt;
  &lt;pixelXDimension xmlns=&quot;http://www.kanzaki.com/ns/exif#&quot;&gt;1500&lt;/pixelXDimension&gt;
  &lt;pixelYDimension xmlns=&quot;http://www.kanzaki.com/ns/exif#&quot;&gt;1000&lt;/pixelYDimension&gt;
  &lt;/rdf:Description&gt;
&lt;/rdf:RDF&gt;</code></pre>
<p>Then with a supporting ActiveFedora model:</p>
<pre class="code ruby"><code><span class='kw'>class</span> <span class='const'>GenericImage</span> <span class='op'>&lt;</span> <span class='const'>ActiveFedora</span><span class='op'>::</span><span class='const'>Base</span>
  <span class='id identifier rubyid_include'>include</span> <span class='const'>ActiveFedora</span><span class='op'>::</span><span class='const'>RelsInt</span>
<span class='kw'>end</span></code></pre>
<p>You can identify the thumbnail image by querying the <span class="caps">RELS</span>-<span class="caps">INT</span> graph:</p>
<pre class="code ruby"><code><span class='id identifier rubyid_my_obj'>my_obj</span> <span class='op'>=</span> <span class='const'>GenericImage</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>test:1</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_statement'>statement</span> <span class='op'>=</span> <span class='id identifier rubyid_my_obj'>my_obj</span><span class='period'>.</span><span class='id identifier rubyid_rels_int'>rels_int</span><span class='period'>.</span><span class='id identifier rubyid_relationships'>relationships</span><span class='lparen'>(</span><span class='id identifier rubyid_my_obj'>my_obj</span><span class='period'>.</span><span class='id identifier rubyid_datastreams'>datastreams</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>content</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>http://xmlns.com/foaf/0.1/thumbnail</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
<span class='kw'>unless</span> <span class='id identifier rubyid_statement'>statement</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
  <span class='id identifier rubyid_dsid'>dsid</span> <span class='op'>=</span> <span class='id identifier rubyid_statement'>statement</span><span class='period'>.</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='comment'># this will be a RDF::Statement
</span>  <span class='id identifier rubyid_thumb_ds'>thumb_ds</span> <span class='op'>=</span> <span class='id identifier rubyid_my_obj'>my_obj</span><span class='period'>.</span><span class='id identifier rubyid_datastreams'>datastreams</span><span class='lbracket'>[</span><span class='id identifier rubyid_dsid'>dsid</span><span class='rbracket'>]</span>
<span class='kw'>end</span></code></pre>
<p>You can also add or delete statements to the <span class="caps">RELS</span>-<span class="caps">INT</span> graph as tested in spec/unit/relsint_spec.rb</p>
<p>Note that the <span class="caps">RELS</span>-<span class="caps">INT</span> datastream is not able to monitor the object, so datastream deletions would require a seperate removal of the deleted datastreams subgraph in <span class="caps">RELS</span>-<span class="caps">INT</span>.</p></div></div>

    <div id="footer">
  Generated on Thu Jan 24 11:22:13 2013 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.2.1 (ruby-1.9.3).
</div>

  </body>
</html>